// MessageBoxWithImage.cs
//

using System;
using System.Collections.Generic;
using jQueryApi;

namespace TuringMachine
{
    public class MessageBoxWithImage : MessageBoxBase
    {
        Label m_lblText;
        Label m_image;
        Label m_title;

        public MessageBoxWithImage(jQueryObject parent) :
            base(parent)
        {
            m_title = new Label(m_msgBox, "title");
            m_title.pObject.CSS("position", "static");
            m_title.pObject.CSS("font-size", "300%");
            m_title.pObject.CSS("width", m_msgBox.GetWidth() + "px");
            m_title.pObject.CSS("height", "60px");
            m_title.pObject.CSS("display", "block");
            m_title.pObject.CSS("text-align", "center");
            m_msgBox.CSS("text-align", "");


            m_image = new Label(m_msgBox, "image");
            m_image.pObject.CSS("position", "static");
            m_image.pObject.CSS("display", "block");
            m_image.pHtml = "<img src='' />";

            m_lblText = new Label(m_msgBox, "text");
            m_lblText.pObject.CSS("position", "static");
            m_lblText.pObject.CSS("display", "block");
            m_lblText.pObject.CSS("font-size", "140%");
            m_lblText.pObject.CSS("margin-left", "30px");
            m_lblText.pObject.CSS("margin-right", "30px");

        }

        public void SetLayout(int iLayout)
        {
            switch (iLayout)
            {
                case 0:
                    m_image.pObject.CSS("padding", "30px 60px 30px 30px");
                    m_image.pObject.CSS("float", "right");
                    m_lblText.pObject.CSS("margin-top", "30px");
                    m_image.pObject.CSS("width", "");
                    m_image.pObject.CSS("text-align", "");
                    break;
                case 1:
                    m_image.pObject.CSS("padding", "30px 30px 30px 30px");
                    m_image.pObject.CSS("float", "left");
                    m_lblText.pObject.CSS("margin-top", "30px");
                    m_image.pObject.CSS("width", "");
                    m_image.pObject.CSS("text-align", "");
                    break;
                case 2:
                    m_image.pObject.CSS("padding", "30px");
                    m_image.pObject.CSS("float", "none");
                    m_image.pObject.CSS("clear", "both");
                    m_image.pObject.CSS("width", m_msgBox.GetWidth() + "px");
                    m_image.pObject.CSS("text-align", "center");
                    m_lblText.pObject.CSS("margin-top", "0px");
                    break;
            }
        }

        public string pImage
        {
            get { return null; }
            set { m_image.pHtml = "<img src='" + value + "' />"; }
        }

        public string pTitleText
        {
            get { return m_title.pText; }
            set { m_title.pText = value; }
        }

        public string pText
        {
            get { return m_lblText.pHtml; }
            set { m_lblText.pHtml = value; }
        }



        protected override void PlaceElements()
        {
            m_msgBox.CSS("height", "500px");
        }
    }
}
